package com.example.qxfw.backgroundManagement.service.impl;

import com.example.qxfw.backgroundManagement.mapper.AgriculturalMonitoringMapper;
import com.example.qxfw.backgroundManagement.service.AgriculturalMonitoringService;
import com.example.qxfw.common.entity.AgriMonitor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * @author ZeLin Wang
 * @version 1.0
 * @description: 监控管理-农情监控
 * @date 2024/7/4 9:46
 */
@Service
public class AgriculturalMonitoringServiceImpl implements AgriculturalMonitoringService {

    @Autowired
    private AgriculturalMonitoringMapper agriculturalMonitoringMapper;

    @Override
    public List<AgriMonitor> selectAgriMonitorInfo() {
        List<AgriMonitor> agriMonitors = agriculturalMonitoringMapper.selectAgriMonitorInfo();
        for(AgriMonitor agriMonitor : agriMonitors){
            agriMonitor.setStationName(agriculturalMonitoringMapper.selectStationName(agriMonitor.getStationId()));
        }
        return agriMonitors;
    }
}